//
//  MineMainViewController.m
//  ArtDog
//
//  Created by dllo on 16/8/27.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "MineMainViewController.h"
#import "MineRegisterController.h"
#import "MineLoginController.h"
#import "HLMacro.h"

@interface MineMainViewController ()

@property (weak, nonatomic) IBOutlet UIButton *registerBtn;

@property (weak, nonatomic) IBOutlet UIButton *loginBtn;

@end

@implementation MineMainViewController


- (void)viewWillAppear:(BOOL)animated
{
    self.tabBarController.tabBar.hidden = YES;
    self.hidesBottomBarWhenPushed = YES;
    [super viewWillAppear:animated];
    if (_isFirstEnter) {
        self.tabBarController.selectedIndex = 0;
        self.tabBarController.selectedIndex = 3;
    }
    if (_isExitLogin) {
        self.tabBarController.selectedIndex = _lastIndex;
        _isExitLogin = NO;
    }
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    _isFirstEnter = NO;
}

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        _isFirstEnter = YES;
        _lastIndex = 0;
        _isExitLogin = NO;
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    _loginBtn.layer.borderWidth = 1;
    _loginBtn.layer.borderColor = [UIColor blackColor].CGColor;
}
- (IBAction)registerAction:(id)sender {
//    if (self.navigationController.viewControllers.count > 1) {
//        [self.navigationController popViewControllerAnimated:NO];
//    }
    MineRegisterController *registerVC = [[MineRegisterController alloc]initWithNibName:@"MineRegisterController" bundle:[NSBundle mainBundle]];
    [self.navigationController pushViewController:registerVC animated:YES];
}

- (IBAction)loginAction:(id)sender {
    MineLoginController *loginVC = [[MineLoginController alloc]initWithNibName:@"MineLoginController" bundle:[NSBundle mainBundle]];
    [self.navigationController pushViewController:loginVC animated:YES];
}

- (IBAction)registerLater:(id)sender {
    //self.hidesBottomBarWhenPushed = NO;
    //self.tabBarController.tabBar.hidden = NO;
    self.tabBarController.selectedIndex = _lastIndex;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}



@end
